#include <stdio.h>

int main(int argc, char *argv[]) {

    int n, m,c,d;
    scanf("%d %d", &n, &m);
    for (size_t i = 0; i < n; i++)
    {
        c = n - i;
        d = i;
        if(d*4+c*2==m){
            printf("%d %d",c,d);
        }
    }
    

    return 0;
}